import { GetCustomPageBtnAuth } from '/@/api/admin/auth';

let authCodeList: string[] = [];
export async function getBtnAuth(route, callback) {
  const { fullPath } = route;
  const moduleId = fullPath.substring(fullPath.lastIndexOf('/') + 1);
  authCodeList = (await GetCustomPageBtnAuth(moduleId)) || [];
  callback && callback();
}

export function checkAuth(authCode: string) {
  return authCodeList.includes(authCode);
}
